package com.zzty.springmybatis.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zzty.springmybatis.entity.Student;
import com.zzty.springmybatis.service.StudentService;

@Controller
@RequestMapping("/Student")
public class StudentController {
	private static final Logger logger = LoggerFactory.getLogger(StudentController.class);
	@Autowired
	StudentService studentService;
	
	@RequestMapping("/getStudent/{id}")
	public String getStudentById(@PathVariable(value="id") Integer id,ModelMap model) {
		Student st=studentService.getStudentById(id);
		model.addAttribute("student", st);
		return "student";
	}
	
	@RequestMapping("/test")
	public String test(ModelMap model) {
		System.out.println("aa");
		logger.info("aaaa");
		return "student";
	}

}
